# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(MyApplication)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/zstd/lib)

set(ZSTD_BUILD_SHARED OFF)
set(ZSTD_BUILD_PROGRAMS OFF)
set(CMAKE_BUILD_TYPE Release)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
    add_compile_options(-O3)
    string(REPLACE "-O2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    string(REPLACE "-O2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
add_subdirectory(zstd/build/cmake)

add_library(zstdnapi SHARED zstd.cpp)
target_link_libraries(zstdnapi PUBLIC libace_napi.z.so libhilog_ndk.z.so -s -ftrapv)
target_link_libraries(zstdnapi PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/zstd/build/cmake/lib/libzstd.a)